<template>
  <div class="home">
    <p>使用声明式</p>
    <!-- <input v-model="keyword" type="text"> -->
    <el-input v-model="keyword" type="text" />
    <div> {{ keyword }}</div>
    <div>传入的值是: {{ option }}</div>
  </div>
</template>

<script>
import eventBus from '@/utils/eventBus'
  export default {
    /* props: {
      option: {
        type: Object,
        default: () => {}
      }
    }, */
    props: ['option'],
    data() {
      return {
        keyword: ''
      }
    },
    mounted () {
      this.init()
      eventBus.$on('test', (val) => {
        console.log('监听到事件', val)
      })
    },
    beforeUnmount() {
      eventBus.$off('test')
    },
    methods: {
      init() {
        this.$emit('changeStatus', 3)
        console.log('试试vue2可以吗')
      }
    },
  }
</script>

<style lang="scss" scoped>
.home {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  .el-input{
    width: 200px;
  }
}
</style>